﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/OneCol.Master" AutoEventWireup="true" CodeBehind="Index.aspx.cs" Inherits="P.InOut.NetMvc.Views.Quotes.Index" %>
<%@ Import Namespace="P.InOut.NetMvc.Models" %>

<asp:Content ID="ScriptsContainer" ContentPlaceHolderID="Scripts" runat="server">
</asp:Content>
<asp:Content ID="HeaderContainer" ContentPlaceHolderID="Header" runat="server">
</asp:Content>
<asp:Content ID="MainContainer" ContentPlaceHolderID="Col1" runat="server">
<h2>Quotes</h2>
<% using( Html.Form( "Quotes", "Create" ) ){ %>
    <fieldset class="MvcMembership">
	    <legend>Add Quote</legend>

	    <div>
	    <label for="author">Author</label>
	    <% =Html.TextBox( "author", new { size = 32, maxlength = 50}) %>
	    </div>
	    
	    <div>
	    <label for="quoteText">Quote</label>
	    <% =Html.TextArea( "quotetext", string.Empty ) %>
	    </div>

	    <div><% =Html.SubmitButton( "Add Quote" ) %></div>

    </fieldset>
<% } %>
    
<fieldset class="MvcMembership">
    <% if( ViewData.Model.Count > 0 ){ %>
	    <% foreach(Quote quote in ViewData.Model ){ %>
	    <div style="margin: 0.5em 1em 0.5em 1em; padding-bottom: 1em; border-bottom: solid 2px #000;">
	        <div><span style="color: Gray;">Quote:</span> <%= quote.Id %> - <% =Html.ActionLink<P.InOut.NetMvc.Controllers.QuotesController>( x=> x.Edit(quote.Id), "Edit" ) %> 
	            (<% =Html.ActionLink<P.InOut.NetMvc.Controllers.QuotesController>(x => x.Delete(quote.Id), 
	                 "Delete", new { onclick = "return confirm('Are you sure you want to delete " + quote.Id + "')" })%>)</div>
	        <div><span style="color: Gray;">Submitted by:</span> <%= quote.Aspnet_Membership.Profile.FirstName + " " + quote.Aspnet_Membership.Profile.LastName %></div>
	        <div><span style="color: Gray;">Approved:</span> <%= quote.Approved %></div>
	        <div><span style="color: Gray;">Author:</span> <%= quote.Author %></div>
	        <div><span style="color: Gray;">Quote:</span> </div>
	        <div><%= quote.QuoteText %></div>
	    </div>
	    <% } %>
	<% }else{ %>
	    <div>No quotes have been added to the system yet.</div>
    <% } %>
</fieldset>

    
</asp:Content>
